﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Zor_DAL;
using Zor_Tools;

namespace Zor_Bll
{
   public class AHouseholdTax_Bll<T>where T : class
    {
       /// <summary>
       /// 获取一户式缴税情况列表
       /// </summary>
       /// <param name="index"></param>
       /// <param name="TotalCount"></param>
       /// <param name="where"></param>
       /// <returns></returns>
       public static List<T> GetPageList(int index, out int TotalCount,string where)
        {
            var sqlSurch = string.Empty;
            int Dtid = RequestSession.GetSessionUser().DT_Id;
            int Isadmin = RequestSession.GetSessionUser().Is_Admin;

            if (Isadmin == 1)    //超级管理员查看所有
            {
                if (where != null && where != "")
                {
                    sqlSurch += " NatPer_IDNumber = '" + where + "'";
                }
                else 
                {
                    sqlSurch = " 1 = 1 ";
                }              
            }
            else  
            {
                if (where != null && where != "")
                {
                    sqlSurch += "( Dt_ParentId = " + Dtid + " or StreetOffice_Id = " + Dtid + " )and  NatPer_IDNumber = '" + where + "'";
                }
                else
                {
                    sqlSurch = " Dt_ParentId = " + Dtid + " or StreetOffice_Id = " + Dtid + "";
                }            
            }
                  
            return PagerHelp<T>.GetPagerList(index, "V_AHouseholdTax", "Pt_Id", out TotalCount, sqlSurch);
        }
       
       /// <summary>
       /// 获取列表不分页
       /// </summary>
       /// <param name="where"></param>
       /// <returns></returns>
       public static List<T> GetList(string where)
       {
           return AHouseholdTax_DAL<T>.SelectViewAHouseholdTax( where);

       }
    }
}
